\(\int x \coth ^2(a+b x) \, dx\) [8]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 10, antiderivative size = 31 \[ \int x \coth ^2(a+b x) \, dx=\frac {x^2}{2}-\frac {x \coth (a+b x)}{b}+\frac {\log (\sinh (a+b x))}{b^2} \]

[Out]

1/2*x^2-x*coth(b*x+a)/b+ln(sinh(b*x+a))/b^2

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 31, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.300, Rules used = {3801, 3556, 30} \[ \int x \coth ^2(a+b x) \, dx=\frac {\log (\sinh (a+b x))}{b^2}-\frac {x \coth (a+b x)}{b}+\frac {x^2}{2} \]

[In]

Int[x*Coth[a + b*x]^2,x]

[Out]

x^2/2 - (x*Coth[a + b*x])/b + Log[Sinh[a + b*x]]/b^2

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3801

Int[((c_.) + (d_.)*(x_))^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b*(c + d*x)^m*((b*Tan[e
 + f*x])^(n - 1)/(f*(n - 1))), x] + (-Dist[b*d*(m/(f*(n - 1))), Int[(c + d*x)^(m - 1)*(b*Tan[e + f*x])^(n - 1)
, x], x] - Dist[b^2, Int[(c + d*x)^m*(b*Tan[e + f*x])^(n - 2), x], x]) /; FreeQ[{b, c, d, e, f}, x] && GtQ[n,
1] && GtQ[m, 0]

Rubi steps \begin{align*} \text {integral}& = -\frac {x \coth (a+b x)}{b}+\frac {\int \coth (a+b x) \, dx}{b}+\int x \, dx \\ & = \frac {x^2}{2}-\frac {x \coth (a+b x)}{b}+\frac {\log (\sinh (a+b x))}{b^2} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.17 (sec) , antiderivative size = 46, normalized size of antiderivative = 1.48 \[ \int x \coth ^2(a+b x) \, dx=\frac {b^2 x^2-2 b x \coth (a)+2 \log (\sinh (a+b x))+2 b x \text {csch}(a) \text {csch}(a+b x) \sinh (b x)}{2 b^2} \]

[In]

Integrate[x*Coth[a + b*x]^2,x]

[Out]

(b^2*x^2 - 2*b*x*Coth[a] + 2*Log[Sinh[a + b*x]] + 2*b*x*Csch[a]*Csch[a + b*x]*Sinh[b*x])/(2*b^2)

Maple [A] (verified)

Time = 0.11 (sec) , antiderivative size = 54, normalized size of antiderivative = 1.74

method result size
risch \(\frac {x^{2}}{2}-\frac {2 x}{b}-\frac {2 a}{b^{2}}-\frac {2 x}{b \left ({\mathrm e}^{2 b x +2 a}-1\right )}+\frac {\ln \left ({\mathrm e}^{2 b x +2 a}-1\right )}{b^{2}}\) \(54\)
parallelrisch \(\frac {-2 \ln \left (1-\tanh \left (b x +a \right )\right ) \tanh \left (b x +a \right )+2 \ln \left (\tanh \left (b x +a \right )\right ) \tanh \left (b x +a \right )+x b \left (-2+\left (b x -2\right ) \tanh \left (b x +a \right )\right )}{2 b^{2} \tanh \left (b x +a \right )}\) \(66\)

[In]

int(x*coth(b*x+a)^2,x,method=_RETURNVERBOSE)

[Out]

1/2*x^2-2*x/b-2*a/b^2-2*x/b/(exp(2*b*x+2*a)-1)+1/b^2*ln(exp(2*b*x+2*a)-1)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 189 vs. \(2 (29) = 58\).

Time = 0.26 (sec) , antiderivative size = 189, normalized size of antiderivative = 6.10 \[ \int x \coth ^2(a+b x) \, dx=-\frac {b^{2} x^{2} - {\left (b^{2} x^{2} - 4 \, b x\right )} \cosh \left (b x + a\right )^{2} - 2 \, {\left (b^{2} x^{2} - 4 \, b x\right )} \cosh \left (b x + a\right ) \sinh \left (b x + a\right ) - {\left (b^{2} x^{2} - 4 \, b x\right )} \sinh \left (b x + a\right )^{2} - 2 \, {\left (\cosh \left (b x + a\right )^{2} + 2 \, \cosh \left (b x + a\right ) \sinh \left (b x + a\right ) + \sinh \left (b x + a\right )^{2} - 1\right )} \log \left (\frac {2 \, \sinh \left (b x + a\right )}{\cosh \left (b x + a\right ) - \sinh \left (b x + a\right )}\right )}{2 \, {\left (b^{2} \cosh \left (b x + a\right )^{2} + 2 \, b^{2} \cosh \left (b x + a\right ) \sinh \left (b x + a\right ) + b^{2} \sinh \left (b x + a\right )^{2} - b^{2}\right )}} \]

[In]

integrate(x*coth(b*x+a)^2,x, algorithm="fricas")

[Out]

-1/2*(b^2*x^2 - (b^2*x^2 - 4*b*x)*cosh(b*x + a)^2 - 2*(b^2*x^2 - 4*b*x)*cosh(b*x + a)*sinh(b*x + a) - (b^2*x^2
 - 4*b*x)*sinh(b*x + a)^2 - 2*(cosh(b*x + a)^2 + 2*cosh(b*x + a)*sinh(b*x + a) + sinh(b*x + a)^2 - 1)*log(2*si
nh(b*x + a)/(cosh(b*x + a) - sinh(b*x + a))))/(b^2*cosh(b*x + a)^2 + 2*b^2*cosh(b*x + a)*sinh(b*x + a) + b^2*s
inh(b*x + a)^2 - b^2)

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 190 vs. \(2 (26) = 52\).

Time = 0.68 (sec) , antiderivative size = 190, normalized size of antiderivative = 6.13 \[ \int x \coth ^2(a+b x) \, dx=\begin {cases} \frac {x^{2} \coth ^{2}{\left (a \right )}}{2} & \text {for}\: b = 0 \\- \frac {x \log {\left (- e^{- b x} \right )} \coth ^{2}{\left (b x + \log {\left (- e^{- b x} \right )} \right )}}{b} - \frac {\log {\left (- e^{- b x} \right )}^{2} \coth ^{2}{\left (b x + \log {\left (- e^{- b x} \right )} \right )}}{2 b^{2}} & \text {for}\: a = \log {\left (- e^{- b x} \right )} \\- \frac {x \log {\left (e^{- b x} \right )} \coth ^{2}{\left (b x + \log {\left (e^{- b x} \right )} \right )}}{b} - \frac {\log {\left (e^{- b x} \right )}^{2} \coth ^{2}{\left (b x + \log {\left (e^{- b x} \right )} \right )}}{2 b^{2}} & \text {for}\: a = \log {\left (e^{- b x} \right )} \\\frac {x^{2}}{2} + \frac {x}{b} - \frac {x}{b \tanh {\left (a + b x \right )}} - \frac {\log {\left (\tanh {\left (a + b x \right )} + 1 \right )}}{b^{2}} + \frac {\log {\left (\tanh {\left (a + b x \right )} \right )}}{b^{2}} & \text {otherwise} \end {cases} \]

[In]

integrate(x*coth(b*x+a)**2,x)

[Out]

Piecewise((x**2*coth(a)**2/2, Eq(b, 0)), (-x*log(-exp(-b*x))*coth(b*x + log(-exp(-b*x)))**2/b - log(-exp(-b*x)
)**2*coth(b*x + log(-exp(-b*x)))**2/(2*b**2), Eq(a, log(-exp(-b*x)))), (-x*log(exp(-b*x))*coth(b*x + log(exp(-
b*x)))**2/b - log(exp(-b*x))**2*coth(b*x + log(exp(-b*x)))**2/(2*b**2), Eq(a, log(exp(-b*x)))), (x**2/2 + x/b
- x/(b*tanh(a + b*x)) - log(tanh(a + b*x) + 1)/b**2 + log(tanh(a + b*x))/b**2, True))

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 115 vs. \(2 (29) = 58\).

Time = 0.23 (sec) , antiderivative size = 115, normalized size of antiderivative = 3.71 \[ \int x \coth ^2(a+b x) \, dx=-\frac {x e^{\left (2 \, b x + 2 \, a\right )}}{b e^{\left (2 \, b x + 2 \, a\right )} - b} - \frac {b x^{2} - {\left (b x^{2} e^{\left (2 \, a\right )} - 2 \, x e^{\left (2 \, a\right )}\right )} e^{\left (2 \, b x\right )}}{2 \, {\left (b e^{\left (2 \, b x + 2 \, a\right )} - b\right )}} + \frac {\log \left ({\left (e^{\left (b x + a\right )} + 1\right )} e^{\left (-a\right )}\right )}{b^{2}} + \frac {\log \left ({\left (e^{\left (b x + a\right )} - 1\right )} e^{\left (-a\right )}\right )}{b^{2}} \]

[In]

integrate(x*coth(b*x+a)^2,x, algorithm="maxima")

[Out]

-x*e^(2*b*x + 2*a)/(b*e^(2*b*x + 2*a) - b) - 1/2*(b*x^2 - (b*x^2*e^(2*a) - 2*x*e^(2*a))*e^(2*b*x))/(b*e^(2*b*x
 + 2*a) - b) + log((e^(b*x + a) + 1)*e^(-a))/b^2 + log((e^(b*x + a) - 1)*e^(-a))/b^2

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 98 vs. \(2 (29) = 58\).

Time = 0.29 (sec) , antiderivative size = 98, normalized size of antiderivative = 3.16 \[ \int x \coth ^2(a+b x) \, dx=\frac {b^{2} x^{2} e^{\left (2 \, b x + 2 \, a\right )} - b^{2} x^{2} - 4 \, b x e^{\left (2 \, b x + 2 \, a\right )} + 2 \, e^{\left (2 \, b x + 2 \, a\right )} \log \left (e^{\left (2 \, b x + 2 \, a\right )} - 1\right ) - 2 \, \log \left (e^{\left (2 \, b x + 2 \, a\right )} - 1\right )}{2 \, {\left (b^{2} e^{\left (2 \, b x + 2 \, a\right )} - b^{2}\right )}} \]

[In]

integrate(x*coth(b*x+a)^2,x, algorithm="giac")

[Out]

1/2*(b^2*x^2*e^(2*b*x + 2*a) - b^2*x^2 - 4*b*x*e^(2*b*x + 2*a) + 2*e^(2*b*x + 2*a)*log(e^(2*b*x + 2*a) - 1) -
2*log(e^(2*b*x + 2*a) - 1))/(b^2*e^(2*b*x + 2*a) - b^2)

Mupad [B] (verification not implemented)

Time = 1.89 (sec) , antiderivative size = 48, normalized size of antiderivative = 1.55 \[ \int x \coth ^2(a+b x) \, dx=\frac {\ln \left ({\mathrm {e}}^{2\,a}\,{\mathrm {e}}^{2\,b\,x}-1\right )}{b^2}-\frac {2\,x}{b}+\frac {x^2}{2}-\frac {2\,x}{b\,\left ({\mathrm {e}}^{2\,a+2\,b\,x}-1\right )} \]

[In]

int(x*coth(a + b*x)^2,x)

[Out]

log(exp(2*a)*exp(2*b*x) - 1)/b^2 - (2*x)/b + x^2/2 - (2*x)/(b*(exp(2*a + 2*b*x) - 1))